import get_storage_sync from '@dfeidao/atom-wxapp/api/cache/get';
import { IFeidaoAiWeappPage } from '@dfeidao/atom-wxapp/interfaces';
import set_local from '@dfeidao/atom-wxapp/local/set';
import render from '@dfeidao/atom-wxapp/render/render';

interface IUser {
	username: {
		value: string;
	};
	password: {
		value: string;
	};
}

export default async function a004(fd: IFeidaoAiWeappPage) {
	const user = await get_storage_sync('user') as IUser;
	if (user) {
		set_local(fd, 'userName', user.username);
		set_local(fd, 'userPwd', user.password);
		render(fd, { userName: user.username.value });
		render(fd, { userPwd: user.username.value });
	}

}
